function legend_file(fig_h, leg_h, name, ftype)

	leg_h.Units = 'pixels';
	fig_h.Units = 'pixels';

	handles = findall(fig_h, 'type', 'line');

	for i = 1:length(handles)
		handles(i).XData = NaN; 
	end

	axis off

	aux = leg_h.LineWidth;
	leg_h.Position = [6 * aux, 6 * aux, leg_h.Position(3), leg_h.Position(4)];
	aux2 = leg_h.Position;

	fig_h.InnerPosition = [1, 1, aux2(3) + 12 * aux, aux2(4) + 12 * aux];

	saveas(fig_h, [name, '.', ftype], ftype);

end

	%
